﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class LocationAdjustmentUIRule
    {
        private static LocationAdjustmentUIRule _NewInstance = new LocationAdjustmentUIRule();

        public static LocationAdjustmentUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new LocationAdjustmentUIRule();
                }

                return _NewInstance;
            }
        }

        public List<LocationGoodsInfo> GetLocationGoodsInfo(string userID)
        {
            try
            {
                List<LocationGoodsInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationAdjustment>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>>("GetLocationGoodsInfo", new object[] { userID });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public List<LocationGoodsBatchInfo> GetLocationGoodsBatchInfo(string userID)
        {
            try
            {
                List<LocationGoodsBatchInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationAdjustment>.NewInstance.InvokeWebMethod<List<LocationGoodsBatchInfo>>("GetLocationGoodsBatchInfo", new object[] { userID });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public OutPutParams<bool> Submit(string userID, List<LocationInventoryInfo> lstLocationInventory)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationAdjustment>.NewInstance.InvokeWebMethod<List<LocationInventoryInfo>, OutPutParams<bool>>("Submit", new object[] { userID }, lstLocationInventory);

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
    }
}
